Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, thank you to the team at Zappar for this library!
Overview
It's really hard to get a user to wait potentially 10s+ for a full splat file to download before anything shows up. This PR adds functionality to the library to progressively display splats as they are streamed from the server.
Breaking!
This PR changes the signature of
GaussianSplatMesh.load()
to accept a config object (defined inGaussianSplatGeometry.load(url, config)
) instead of only aloadingManager
.Alternatives
I did consider a few alternatives, but since this library just hit
0.1.0
, I figured it wouldn't be too late to add toGaussianSplatMesh.load()
itself! (::If the maintainers decide otherwise, please do edit/note in the review of the PR!
GaussianSplatMesh.load()
& aGaussianSplatMesh.stream()
methodGaussianSplatMesh.load(url, loadingManager?, progressive?)
Concerns/Questions
SplatLoader
written in ES6 instead of modern JS? Considering the rest of the library is written modernly 😅. I followed that style nonetheless there, but it makes the code a little more clunky. In the future it could be changed to use theAsyncIterable
directly fromReadableStream
instead of recursively calling the processing function (as well asasync
/await
hopefully xdd).Miscellaneous Notes
trimBuffer
function that calledslice
internally. Instead,subarray
was used to create another view to the underlyingArrayBuffer
/SharedArrayBuffer
SharedArrayBuffer
, it's used to write to the worker's memory from theReadableStream
in JS. If I'm not mistaken this introduces a requirement of headers to be included in the top-level document (SharedArrayBuffer
is still technically constructable without it, so I'm not sure where the library gets its instances, or the difference between the 2 imports inworker.ts
mean 😅). I documented this & the change in signature in the README, & added some more info regarding setting up the headers.